<!-- RiffMates/templates/venues.xhtml -->
{% extends "base.xhtml" %}

{% block title %}
  {{block.super}}: Venue Listing
{% endblock %}

{% block content %}
  <h1>Venues</h1>

  <ul>
    {% for venue in venues %}
      <li>
        <b> {{venue.name}} </b>
        {% if venue.controlled %}
          <br/>
          &nbsp; &nbsp; &nbsp;
          <a href="{% url 'edit_venue' venue.id %}">Edit</a>
          <br/>
        {% endif %}
        {% if venue.picture %}
          <br/>
          &nbsp; &nbsp; &nbsp;
          <img src="{{venue.picture.url}}" height="50"/>
          <br/>
        {% endif %}
        {% if venue.description %}
          <br/>
          <i> &nbsp; &nbsp; &nbsp; {{venue.description }} </i>
          <br/>
        {% endif %}
        Rooms:
      </li>
      <ul>
        {% for room in venue.room_set.all %}
          <li> {{room.name}} </li>
        {% empty %}
          <li> <i>No rooms for this venue</i> </li>
        {% endfor %}
      </ul>
    {% empty %}
      <li> <i>No venues in the database</i> </li>
    {% endfor %}
  </ul>

  {% if page.has_other_pages %}
    {% if page.has_previous %}
      <a href="{% url 'venues' %}?page={{page.previous_page_number}}"> Prev</a>
      &nbsp;&nbsp;&nbsp;
    {% endif %}
    {% if page.has_next %}
      <a href="{% url 'venues' %}?page={{page.next_page_number}}"> Next</a>
    {% endif %}
  {% endif %}
{% endblock content %}
